﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    [Serializable]
    [DataContract]
    public  class GuaZhiDuanLianJiHuaModel
    {
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
        private int _Sec;
        [DataMember]
        public int Sec
        {
            get { return _Sec; }
            set { _Sec = value; }
        }
        private int _Year;
        [DataMember]
        public int Year
        {
            get { return _Year; }
            set { _Year = value; }
        }

        private string _Name;
        [DataMember]
        public string Name
        {
            get { return _Name; }
            set { _Name = value; }
        }

        private bool _IsLocked;
        [DataMember]
        public bool IsLocked
        {
            get { return _IsLocked; }
            set { _IsLocked = value; }
        }

        private string _IsLockedString;
        [DataMember]
        public string IsLockedString
        {
            get { return _IsLockedString; }
            set { _IsLockedString = value; }
        }

        private string _Status;
        [DataMember]
        public string Status
        {
            get { return _Status; }
            set { _Status = value; }
        }
        public static GuaZhiDuanLianJiHuaModel FillEntity(DataRow dr)
        {
            GuaZhiDuanLianJiHuaModel right = new GuaZhiDuanLianJiHuaModel();
            if (dr.Table != null && dr.Table.Columns.Contains("Status")) if (!string.IsNullOrEmpty(dr["Status"].ToString())) right.Status = dr["Status"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("Sec")) right.Sec = Convert.ToInt32(dr["Sec"]);
            right.ID = Convert.ToInt32(dr["ID"]);
            if (!string.IsNullOrEmpty(dr["Year"].ToString())) right.Year = Convert.ToInt32(dr["Year"]);
            if (!string.IsNullOrEmpty(dr["Name"].ToString())) right.Name = dr["Name"].ToString();
            right.IsLocked = Convert.ToBoolean(dr["IsLocked"]);
            if (right.IsLocked) right.IsLockedString = "已锁定"; else right.IsLockedString = "未锁定";
            return right;
        }
    }
}
